<%@ page
	import="wbhproject.tools.*,javax.sql.*,java.sql.*,javax.naming.*"%>
<html>
<head>
</head>
<body>
	<h1>File 'index.jsp' of application 'WBH-Projekt-Studie'</h1>
	<h2>Project is SVN-hosted by google-code ...</h2>
	<h3>Next -Test-</h3>
	<p>
		Page sent from server:
		<%=String.valueOf(new java.util.Date())%></p>
	<h3>"Test"-servlet</h3>
	<p>
		Base-address (does nothing...): <a href="Test">/Test</a>
	</p>
	<p>
		Stop MeasurePointRequestor: <a href="Test?mode=stoprequestor">/Test/stoprequestor</a>
	</p>
	<p>
		Start MeasurePointRequestor: <a href="Test?mode=startrequestor">/Test/startrequestor</a>
	</p>

	<h3>Statistics</h3>
	<%
		Configuration myConfig = Configuration.getInstance();
		Context envContext = null;
		long measureCounter = 10;
		Date lastUpdate = null;
		try {
			envContext = new InitialContext();
			DataSource ds = (DataSource) envContext.lookup(myConfig
					.getDataSourceContext());
			Connection con = ds.getConnection();

			Statement stmt = con.createStatement();
			ResultSet rs = stmt
					.executeQuery("SELECT COUNT(*) AS 'mycounter' FROM measure");
			rs.next();
			measureCounter = rs.getLong("mycounter");
			rs = stmt
					.executeQuery("SELECT MAX(at) AS 'lastupdate' FROM measure");
			rs.next();
			lastUpdate = rs.getDate("lastupdate");
			rs.close();
			stmt.close();
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (NamingException e) {
			e.printStackTrace();
		}
	%>
	<p>
		Configuration loaded:
		<%=String.valueOf(myConfig.getBirthDate())%></p>
	<p>
		Number of records in table 'measure':
		<%=String.valueOf(measureCounter)%></p>
	<p>
		Last update in table 'measure':
		<%=String.valueOf(lastUpdate)%></p>
	<p>
		MeasurePointRequestor actually running:
		<%=MeasurePointRequestorController.requestorRunning()%></p>
		<h3>Other...</h3>
		<a href="jstest.jsp">Java-Script testpage</a><br/>
		<a href="flotstudy.jsp">JQuery/Flot testpage</a><br/>
</body>
</html>